<!--根据这个页单独设置样式-->
<style>
    .table-responsive{overflow-x: inherit}
    td{ vertical-align: middle!important;}
    .pagination{ margin:0!important;}
    .flot{float: left}
    .rlot{float: right}
</style>
<script type="text/ng-template" id="addAdvert.html">
    <div class="modal-header">
        <h3 class="modal-title">添加广告图</h3>
    </div>
    <div class="modal-body">
        <div class="row" style="padding: 1% 0">
            <div class=" " style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">标题：</div>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="vm.title" type="text" placeholder="请在这里输入标题">
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div class=" " style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">图片：</div>
                <div class="col-sm-8">
                    <img style="width: 100%" class="content-add-image" ng-src="{{fileItem|imgwhq}}" err-src="300:300:90" alt="">
                </div>
                <div class="col-sm-9" style="padding-left: 18.4%">
                    <input type="file" name="certificate" nv-file-select="" uploader="uploader"
                           ng-click="clearItems()" style="position: absolute;height:50px;opacity: 0;"/>
                    <button class="btn btn-default">选择图片</button>
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">第1行文字：</div>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="vm.word_1" type="text" placeholder="第1行文字">
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">第2行文字：</div>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="vm.word_2" type="text" placeholder="第2行文字">
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">文案：</div>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="vm.button_word" type="text" placeholder="链接,按钮文案">
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div  style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">类型：</div>
                <div class="col-sm-8">
                    <select class="form-control" ng-model="vm.type">
                        <option value="">全部类型</option>
                        <option value="1">分类</option>
                        <option value="2">商品</option>
                        <option value="3">网页</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="row">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">类型对应值：</div>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="vm.value" type="text" placeholder="类型对应值">
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">位置：</div>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="vm.position" type="text" placeholder="请在这里输入位置">
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">状态：</div>
                <div class="col-sm-8">
                    <label class="i-switch m-t-xs m-r">
                        <input type="checkbox"
                               ng-true-value="'1'"
                               ng-false-value="'0'"
                               ng-model="vm.status" >
                        <i></i>
                    </label>
                </div>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-sm btn-danger" ng-click="cancel()">Cancel</button>
        <button class="btn btn-sm btn-success" ng-click="ok()">OK</button>
    </div>
</script>
<script type="text/ng-template" id="upAdvert.html">
    <div class="modal-header">
        <h3 class="modal-title">修改广告图</h3>
    </div>
    <div class="modal-body">
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">标题：</div>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="vm.title" type="text" placeholder="请在这里输入标题">
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">图片：</div>
                <div class="col-sm-8">
                    <img style="width: 100%" class="content-add-image" ng-src="{{fileItem|imgwhq}}" err-src="300:300:90" alt="">
                </div>
                <div class="col-sm-9" style="padding-left: 18.4%">
                    <input type="file" name="certificate" nv-file-select="" uploader="uploader"
                           ng-click="clearItems()" style="position: absolute;height:50px;opacity: 0;"/>
                    <button class="btn btn-default">选择图片</button>
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">第1行文字：</div>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="vm.word_1" type="text" placeholder="第1行文字">
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">第2行文字：</div>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="vm.word_2" type="text" placeholder="第2行文字">
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">文案：</div>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="vm.button_word" type="text" placeholder="链接,按钮文案">
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">类型：</div>
                <div class="col-sm-8">
                    <select class="form-control" ng-model="vm.type">
                        <option value="">全部类型</option>
                        <option value="1">分类</option>
                        <option value="2">商品</option>
                        <option value="3">网页</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">类型对应值：</div>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="vm.value" type="text" placeholder="类型对应值">
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">位置：</div>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="vm.position" type="text" placeholder="请在这里输入位置">
                </div>
            </div>
        </div>
        <div class="row" style="padding: 1% 0">
            <div style="padding-bottom: 10px;width: 100%">
                <div class="col-sm-2 text-right" style="padding-top: 5px;">状态：</div>
                <div class="col-sm-8">
                    <label class="i-switch m-t-xs m-r">
                        <input type="checkbox"
                               ng-true-value="'1'"
                               ng-false-value="'0'"
                               ng-model="vm.status" >
                        <i></i>
                    </label>
                </div>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-sm btn-danger" ng-click="cancel()">Cancel</button>
        <button class="btn btn-sm btn-success" ng-click="ok()">OK</button>
    </div>
</script>
<div>
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">广告图
            <button class="btn btn-sm pull-right btn-success" ng-click="model.open()">添加</button>
        </h1>
    </div>
    <div class="padder-md m-b-none m-t" style="padding-top: 0">
        <div class="panel panel-default">
            <div class="panel-heading">广告图列表</div>
            <div class="table-responsive">
                <table class="table table-striped b-t b-light">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>图片</th>
                        <th>描述</th>
                        <th>位置</th>
                        <th>排序</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="data in ctrl.vm.data">
                        <td>{{data.id}}</td>
                        <td style="width: 15%">
                            <img  ng-src="{{data.image | imgwhq:200:200:90}}" alt="">
                        </td>
                        <td>
                            {{data.info}}
                        </td>
                        <td>{{data.position}}</td>
                        <td>{{data.sort}}</td>
                        <td>
                            <span class="label bg-success" ng-if="data.enable==1">启用</span>
                            <span class="label bg-danger" ng-if="data.enable==0">禁用</span>
                        </td>

                        <td>
                            <button class="btn btn-sm btn-primary" ng-click="model.open1(data)">编辑</button>
                            <button class="btn btn-sm btn-danger" ng-click="model.del(data)">删除</button>
                        </td>
                    </tr>
                    <tr ng-if="!ctrl.vm.data.length">
                        <td colspan="12" class="text-center">暂无数据！</td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <footer class="panel-footer">
            <div class="row">
            <div class="col-sm-4 hidden-xs">
            <select
            class="input-sm form-control w-sm inline v-middle"
            ng-model="placement.selected"
            ng-options="o as o for o in placement.options"
            ng-change="placement.changeFn()"
            >
            </select>
            </div>
            <div class="col-sm-8 text-right text-center-xs">
            <div class="pagination pagination-sm m-t-none m-b-none">
            <uib-pagination
            boundary-links="true"
            total-items="vm.page.total"
            max-size="placement.pageSize"
            items-per-page="placement.selected"
            ng-model="vm.page.current_page"
            ng-change="pageChanged()"
            class="pagination-sm"
            previous-text="&lsaquo;"
            next-text="&rsaquo;"
            first-text="&laquo;"
            last-text="&raquo;"
            >
            </uib-pagination>
            </div>
            </div>
            </div>
            </footer>
        </div>
    </div>
</div>